package lang;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DecimalFormat;

public class BigIntegerTest {
	public static void main(String[] args) {
		double f1=111231.5585;
		BigDecimal big=new BigDecimal(f1);
		double d = big.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		System.out.println(d);
		DecimalFormat dfD=new DecimalFormat("000000.00");
		System.out.println(dfD.format(f1));
		System.out.println(Math.random());
		System.out.println(Math.rint(f1));
		
	}

	@SuppressWarnings("unused")
	private static void M2() {
		double f = 111231.5585;
		BigDecimal b = new BigDecimal(f);
		double f1 = b.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
		System.out.println(f1);
	}

	@SuppressWarnings("unused")
	private static void M1() {
		BigInteger big = new BigInteger("100");
		System.out.println(big.signum());
		BigDecimal big1 = new BigDecimal("1.2222");
		big1.setScale(1, BigDecimal.ROUND_HALF_UP);
		System.out.println(big1.doubleValue());
		DecimalFormat df = new DecimalFormat("#.##");
		System.out.println(df.format(1.222222));
	}

}
